import 'package:freezed_annotation/freezed_annotation.dart';
import 'dart:convert';

part 'index_get_topic_response.freezed.dart';
part 'index_get_topic_response.g.dart';

@freezed
class IndexGetTopicResponse with _$IndexGetTopicResponse {
  const factory IndexGetTopicResponse({
    @JsonKey(name: "code") required int code,
    @JsonKey(name: "msg") required String msg,
    @JsonKey(name: "time") required int time,
    @JsonKey(name: "data") required List<Datum> data,
  }) = _IndexGetTopicResponse;

  factory IndexGetTopicResponse.fromJson(Map<String, dynamic> json) =>
      _$IndexGetTopicResponseFromJson(json);
}

@freezed
class Datum with _$Datum {
  const factory Datum({
    @JsonKey(name: "id") required int id,
    @JsonKey(name: "title") required String title,
    @JsonKey(name: "sort") required int sort,
    @JsonKey(name: "status") required int status,
    @JsonKey(name: "create_time") required int createTime,
    @JsonKey(name: "admin_id") required int adminId,
    @JsonKey(name: "image") required String image,
    @JsonKey(name: "jianjie") required String jianjie,
    @JsonKey(name: "goods_num") required int goodsNum,
  }) = _Datum;

  factory Datum.fromJson(Map<String, dynamic> json) => _$DatumFromJson(json);
}
